import request from '@/api/index'

// 获取充值记录列表
export function getRechargeList(params) {
  return request({
    url: '/recharges',
    method: 'get',
    params
  })
}

// 获取充值记录详情
export function getRechargeDetail(id) {
  return request({
    url: `/recharges/${id}`,
    method: 'get'
  })
}

// 创建充值记录
export function createRecharge(data) {
  return request({
    url: '/recharges',
    method: 'post',
    data
  })
}

// 更新充值记录
export function updateRecharge(id, data) {
  return request({
    url: `/recharges/${id}`,
    method: 'put',
    data
  })
}

// 删除充值记录
export function deleteRecharge(id) {
  return request({
    url: `/recharges/${id}`,
    method: 'delete'
  })
}

// 更新充值记录状态
export function updateRechargeStatus(id, status) {
  return request({
    url: `/recharges/${id}/status`,
    method: 'put',
    data: { status }
  })
}